package test.popup.actions;

import java.io.File;
import java.util.ArrayList;

import org.eclipse.core.resources.IProject;
import org.eclipse.emf.common.util.URI;
import org.eclipse.gmt.modisco.java.CompilationUnit;
import org.eclipse.gmt.modisco.java.Model;

import org.eclipse.java.generation.GenerateJava;


public class JavaDiscover {

	public JavaDiscover() {}

	public void modelDiscovery(IProject pr, String savePath){
		try {


		} catch (Exception e) {
			System.err.println("Error: " + e.getMessage());
		}
	}

	public void generateJava(String javaModelFilepath, String generatedCodeFolderPath){
		try {
			GenerateJava g =new GenerateJava(URI.
					createFileURI(javaModelFilepath), 
					new File(generatedCodeFolderPath), 
					new ArrayList<Object>());
			g.generate(null);

		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public static void main(String[] args)
	{
		org.eclipse.gmt.modisco.java.emf.impl.JavaFactoryImpl factory= 
				new org.eclipse.gmt.modisco.java.emf.impl.JavaFactoryImpl();
		Model model = factory.createModel();
		model.setName("Test");
		CompilationUnit cu = factory.createCompilationUnit();
		cu.setName("A.java");
	}
}